﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sylva.AppML.DatabaseSchema;
using System.IO;
using System.Data.Metadata.Edm;


namespace Sylva.AppML.DatabaseSchema.Test
{
    [TestClass]
    public class DatabaseSchemaTest
    {
        [TestMethod]
        public void TestGenerateEdm()
        {

            string modeFolder = @"D:\Personal\SkyDrive\Projects\AppML\AppMLApplication\DatabaseSchema.Test\TestData\DatabaseSchemaTestModel";
            SchemaManager.GenerateEdmOptions options = new SchemaManager.GenerateEdmOptions()
            {
                ConnectionString = @"Data Source=STEVEN-PC\SQLEXPRESS; Initial Catalog=YN_Test; Integrated Security=SSPI",
                GeneratedPath = modeFolder
            };
            EntityContainer container = SchemaManager.GenerateEdm(options);

            EntitySet set = (EntitySet)container.BaseEntitySets[0];
            Assert.AreEqual(set.ElementType.Properties.Count, 26);
        }
    }
}
